Database actions
Using Database actions is possible to exchange data with external SQL databases.
DBInit
Important: This action is used only once on an empty database. It is not an initialization command to be called any time the HMI device starts.
Creates the set of tables required by the project. You do not need to use this action if the database already contains the necessary tables.
Use Custom SQL query parameter to define the pages to be created. Leave empty to generate default table names
Tip: Add this command inside a SetUp page of your project, used by authorized personal only when installing the application for the first time.
JavaScript Interface
project.dbInit(dbLinkName, sqlCustomQuery);
DBWriteTags, DBReadTags
Transfer the values of the selected tags to/from the remote database.
JavaScript Interface
project.dbWriteTags(dbLinkName, sqlCustomQuery, Tags);
project.dbReadTags(dbLinkName, sqlCustomQuery, Tags);
DBWriteGroups, DBReadGroups
Transfer groups of tags between the HMI device and the database.
JavaScript Interface
project.dbWriteGroups(dbLinkName, sqlCustomQuery, Groups);
project.dbReadGroups(dbLinkName, sqlCustomQuery, Groups);
DBWriteTrend
Inserts the values of the last data sampled in the selected range of time inside the Trends table of the remote database.
JavaScript Interface
project.dbWriteTrends(dbLinkName, sqlCustomQuery, trendName, durationIndex)
DBWriteEvents
Inserts the values of the last events in the selected range of time inside the Events table of the remote database.
JavaScript Interface
project.dbWriteEvents (dbLinkName, sqlCustomQuery, archiveName, durationIndex)
DBWriteRecipes, DBReadRecipes
Transfer the recipe data to/from the remote database.
JavaScript Interface
project.dbWriteRecipes(dbLinkName, sqlCustomQuery, recipeNames)
project.dbReadRecipes(dbLinkName, sqlCustomQuery, recipeNames)
DBResetErrors
Reset all the three status variables of the selected database link. (See Database variables in "Default variables").
JavaScript Interface
project.dbResetErrors(dbLinkName)
RefreshDBTable
Executes the SQL query of the selected "DB table data source" widget to update its data.